-- this is so important it has its own file.

local titleMaxWidth = 220;   -- zoom 0.75 = 220 * 1.5
local subtitleMaxWidth = 512;
local artistMaxWidth = 280;

function TextBannerAfterSet(self,param)
	local Title = self:GetChild("Title");
	local Subtitle = self:GetChild("Subtitle");
	local Artist = self:GetChild("Artist");

	-- no subtitle
	if Subtitle:GetText() == "" then
		( cmd( zoom,1.0;maxwidth,titleMaxWidth;y,-8;strokecolor,color("0,0,0,0.25") ) )(Title);
		( cmd( visible,false ) )(Subtitle);
		( cmd( zoom,0.6;maxwidth,artistMaxWidth;y,12;strokecolor,color("0,0,0,0.25") ) )(Artist);

	-- yes subtitle
	else
		local full = Title:GetText() .." ".. Subtitle:GetText()
		if string.len(full) <= 24 then
			Title:settext(full);
			(cmd(zoom,1.0;maxwidth,titleMaxWidth;y,-8;strokecolor,color("0,0,0,0.25")))(Title);
			(cmd(visible,false))(Subtitle);
		else
			(cmd(zoom,0.75;maxwidth,titleMaxWidth*1.35;y,-12;strokecolor,color("0,0,0,0.25")))(Title);
			(cmd(zoom,0.45;maxwidth,subtitleMaxWidth;visible,true;strokecolor,color("0,0,0,0.25")))(Subtitle);
		end
		(cmd(zoom,0.60;maxwidth,artistMaxWidth;y,12;strokecolor,color("0,0,0,0.25")))(Artist);
	end;

--[[ color changes ]]
	-- DVNO used to be here but then it got hardcoded into the binary. fuck yeah

	if Title:GetText() == "Travestieten Transsexuelen" and
	Subtitle:GetText() == "Over The Rainbow" and
	Artist:GetText()   == "Cardopusher" then
		local colors = {
			{ Length = 1; Diffuse = HSV(  0, 1.00, 1.00) }, -- Red
			{ Length = 1; Diffuse = HSV( 60, 1.00, 1.00) }, -- Yellow
			{ Length = 1; Diffuse = HSV(128, 1.00, 1.00) }, -- Green
			{ Length = 1; Diffuse = HSV(168, 1.00, 1.00) }, -- Blue
			{ Length = 1; Diffuse = HSV(233, 1.00, 1.00) }, -- Indigo
			{ Length = 1; Diffuse = HSV(256, 0.45, 0.93) }, -- Violet
			{ Length = 1; Diffuse = HSV(  0, 1.00, 1.00) }  -- Red
		};
		for i=1,#colors do
			Subtitle:AddAttribute(i+8,colors[i]);
		end;
	end;

--[[ changes that modify the actual text on the TextBanner ]]
	if Title:GetText() == "Body Flow" and Artist:GetText() == "Gammer" then
		-- hypnodance theme song
		Title:settext("Hypnodance Theme Song");
		Artist:settext("Hypnodance (dougal and gabber)");
	end;

	if Title:GetText() == "Father Connection" and Artist:GetText() == "Silent Hill" then
		Title:settext("Terrible Song");
		Artist:settext("a video game by konami");
	end;

end;
-- no need to ask my name to figure out how cool I am
